#ifndef VEC_VERTEX_H_
#define VEC_VERTEX_H_

#include <assert.h>

#include "graph_support/GraphSupport.h"

#include "graph_support/impls/Edge.h"

namespace GRAPH_SUPPORT_NS
{
namespace impls
{
namespace vector
{

template <
			typename VertexT,
			typename EdgeAttributesT
			>
class VertexWrap
{
private:
	typedef VertexT GrVertex;
	typedef VertexWrap< GrVertex, EdgeAttributesT > MyT;
	typedef Edge< GrVertex, MyT, EdgeAttributesT > GrEdge;
	typedef GrEdge * GrEdgePtr;
	typedef std::vector< GrEdgePtr > EdgePtrVector;

public:
	typedef typename EdgePtrVector::iterator EdgeIterator;

public:
	/**
	 * NULL - state of wrap, initialized with this constructor wrap is invalid, it requires reinitialisation.
	 * this constructor was added in order to store wraps in vector.
	 */
	VertexWrap()
	{
	}

	VertexWrap( const GrVertex vertex )
		: vertex( vertex )
	{
	}

	operator GrVertex () const
	{
		return vertex;
	}

	EdgeIterator getEdgesBeg()
	{
		return EdgeIterator( outcomeEdges.begin() );
	}

	EdgeIterator getEdgesEnd()
	{
		return EdgeIterator( outcomeEdges.end() );
	}

	const EdgePtrVector & getOutcomeEdges() const
	{
		return outcomeEdges;
	}

// modify
public:
	void addEdge( GrEdge * edge )
	{
		assert( edge->beg() == this->vertex );
		outcomeEdges.push_back( edge );
	}

private:
	GrVertex vertex;
	EdgePtrVector outcomeEdges;
};

}
}
}

#endif /* VEC_VERTEX_H_ */
